<script type="text/javascript" >
    stFacebookToolbox.sortColumn();
    stFacebookToolbox.shortAction();
    function toggleDiv(id, id1){
        stFacebookToolbox.loadPage('appPostcards', null, null, function(){
            toggleDiv('upload_field', 'uploadObject', 'createBucket');
        }); 
    }
</script>
<style type="text/css">
    #stcontainer .buttonActionContainer{
        left: 186px;
        margin-top: -30px;
        position: absolute;
    }
</style>
<div class="buttonActionContainer">
    <a href="javascript:stFacebookToolbox.loadPage('appPostcardsCategoryEdit')" onclick="" class="button add-new-h2 buttonAction">
        <?php _e('Create new category', $config['plugin_name'])?>
    </a>
</div>
<div class="w100p bgl">
    <div class="w100p bgr">
        <div class="inner_container">
            <?php echo $functions->appPostcardMenu();?>
            <table class="widefat" cellspacing="0">
                <thead>
                    <tr>
                        <?php print_column_headers('stFacebookToolbox_stPostcardCategory'); ?>
                    </tr>
                </thead>

                <tbody>
                <?php
                if (count($results) > 0) {
                    $tr_class = "";
                    foreach ($results as $result) {
                        $time = explode(' ', $result->cdate);
                        $date = explode('-', $time[0]);
                        $date = $date[2].'.'.$date[1].'.'.$date[0];
                        $time = $time[1];
                        $cdate = $date.' '.$time;
                        
                        if( empty($tr_class) || $tr_class == "class='bg_gray2'"){
                            $tr_class = "class='bg_gray1'";
                        }else{
                            $tr_class = "class='bg_gray2'";
                        }
                        echo "<tr id='$result->id' $tr_class >"
                        . "<td>" . $result->title
                        . "<div class=\"row-actions short_action\">"
                        . "<span class='edit' action='appPostcardsCategoryEdit' short_action='' id='$result->id'>Edit | </span>"
                        . "<span class='trash' short_action='delete' id='$result->id' confirm='Are you sure you want to delete this category?'>Trash </span>"
                        . "</div>"
                        . "</td>"
//                        . "<td>" . $result->title . "</td>"
                        . "<td>" . $result->description . "</td>"  
                        . "<td>" . $cdate . "</td>"              
                        . "</tr>"
                        ;
                    }
                }
                ?>
                </tbody>
            </table>
            <div class="page_d">
                <?php echo $pagination?>
                <div class="cl"></div>
            </div>

        </div>
    </div>
</div>